<template>
	<view class="content">
	 <view class="navs_head">
	 	<text>检e达</text>
	 </view>
	 <view class="main">
		 <!-- 消息通知模块 -->
<!-- 	 	<view class="notice_wrap">
			  <view class="notice_left">
			  	<image src="../../static/img/notice_logo.png" mode=""></image>
				<text>{{toolTip}}</text>
			  </view>
			  <image src="../../static/icon/arrow_right.png" mode=""></image>
	 	</view> -->
		<!-- 建议书、文书、意见书模块-->
		<view class="successBook">
			<view class="book_left" @click="suggestBook(1)">
				<view class="titleRow" >
					检察建议书
				</view>
				<image src="../../static/img/document.png" mode=""></image>
			</view>
			<view class="book_right">
				<view @click="suggestBook(2)">
				<view class="titleRow">
					检察意见书
				</view>	
				<image src="../../static/img/suggest_doc.png" mode=""></image>
				</view>
				<view @click="suggestBook(3)">
				<view class="titleRow">
					磋商文书
				</view>	
				<image src="../../static/img/access_doc.png" mode=""></image>
				</view>
			</view>
		</view>
		<!-- 签收状态-->
		<view class="signForReceipt">
			<view v-for="(item,index) in receiptList" :key="index" @tap="skipPage(item.title)">
				<view class="receiptLeft">
					<image :src="`../../static/icon/reci/0${index+1}.png`" mode=""></image>
					<text>{{item.title}}</text>
				</view>
				<view class="receiptRight">
					<view class="toolTip" v-show="item.notice">
						{{item.notice}}
					</view>
					<image src="../../static/icon/arrow_right.png" mode=""></image>
				</view> 
			</view>
		</view>
	 </view>
	 <!-- <signature-brand></signature-brand> -->
	</view>
</template>

<script setup>
import {ref} from 'vue'
import {seeFileStatusStatic,reqFeedBackInfo} from '@/api/file.js'
import {onLoad,onShow} from '@dcloudio/uni-app'
const receiptList = ref([
	{title:"待签收",notice:0},
	{title:"已签收",notice:0},
	{title:"待反馈",notice:0},
	{title:"已反馈",notice:0}])
const suggestBook = (type)=>{
	uni.navigateTo({
		url:`/pages/suggestBook/suggestBook?type=${type}`
	})
	let url = ""

}
// 签收状态
const skipPage = (title)=>{
	// 使用事件总线的方式
	uni.switchTab({
		url:`/pages/onLineDoc/onLineDoc`,
		success() {
			uni.$emit('accessState',{title})
		}
	})
}
// 获取文书处理数量统计
const staticNum = async()=>{
const {code,data:res} = await seeFileStatusStatic()
if(code === 200){
	if(res){
		const {pendingCount,feedPendingCount} = res
		receiptList.value[0].notice = pendingCount
		receiptList.value[2].notice = feedPendingCount
	}
}
}
// 获取反馈信息提醒
const toolTip = ref("")
const getFeedBackInfo = async()=>{
const {code,data,msg} = await reqFeedBackInfo()
if(code === 200){
	toolTip.value = msg
}
}
onLoad(()=>{
	try{
	getFeedBackInfo()	
	}catch(e){
		//TODO handle the exception
		return Promise.reject(e)
	}

})
onShow(()=>{
	staticNum()
})

</script>

<style lang="scss" scoped>
	@font-face {
		font-family: "FZDH";
		src:url('/static/fzdh.TTF') format('ttf')
	}
	.content{
		background-color: #f5faff;
		height: 100vh;
		/* #ifdef H5 */
		// height: calc(100vh - 90rpx);
		/* #endif */
	}
	.navs_head{
		height: 12.5vh;
		/* #ifdef H5 */
		height: 8vh;
		/* #endif */
		// background-color: #fff;
		display: flex;
		justify-content: flex-start;
		align-items: flex-end;
		padding-bottom: 20rpx;
		padding-left: 32rpx;
		>text{
			font-weight: normal;
			font-size: 48rpx;
			color: #00041A;
			line-height: 58rpx;
			font-family: "FZDH";
		}
	}
	.main{
		padding: 32rpx 32rpx 0;
		.notice_wrap{
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 72rpx;
			border-radius: 16rpx;
			background-color:#fcf4da ;
			padding: 0 32rpx 0 10rpx;
			.notice_left{
				display: flex;
				align-items: center;
				image{
					width: 48rpx;
					height: 48rpx;
					margin-right: 20rpx;
				}
				text{
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #00041A;
					
				}
			}
			>image{
				width: 24rpx;
				height: 24rpx;
			}
		}
		.successBook{
			display: flex;
			margin-top: 32rpx;
			height: 320rpx;
			.book_left{
			position: relative;
				justify-content: space-around;
				flex: 1;
				margin-right: 32rpx;
		         background: linear-gradient(to bottom, #d3e2fe, #ecf3fe);
				background-size: 100% 100%;
				border-radius: 16rpx;
				.titleRow{
					width: 100%;
					text-align: center;
					position: absolute;
					top: 66rpx;
					left: 50%;
					transform: translateX(-50%);
				}
				>image{
					width: 178rpx;
					height: 170rpx;
					position: absolute;
					bottom: 0;
					left: 50%;
					transform: translateX(-50%);
				}
			}
			.book_right{
				display: flex;
				flex-direction: column;
				flex: 1;
				>view{
					flex: 1;
					border-radius: 16rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					&:first-child{
						margin-bottom: 32rpx;
						background: linear-gradient(to bottom, #f8e6e2, #faeff1);
					}
					&:last-child{
						background: linear-gradient(to bottom, #c3e9fd, #e1f6fe);
					}
					.titleRow{
						min-width: 180rpx;
						text-align: right;
					}
					>image{
						width: 68rpx;
						height: 74rpx;
						margin-left: 15rpx;
					}
				}
			}
			.titleRow{
				font-family: PingFangSC, PingFang SC;
				font-weight: 600;
				font-size: 32rpx;
				display: inline-block;
				color: #00041A;
				&::after{
					    display: inline-block;
					    content:"";
			            width: 0;
			            height: 0;
			            border-top: 13rpx solid transparent;
			            border-bottom: 13rpx solid transparent;
			            border-left: 15rpx solid #00041A; /* 红色箭头 */
				}
			}
		}
		.signForReceipt{
			margin-top: 32rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			>view{
				height: 96rpx;
				align-items: center;
				width: 48%;
				display: flex;
				justify-content: space-between;
				background: #FFFFFF;
				border-radius: 16rpx;
				padding: 0 10rpx 0 32rpx;
				margin-top: 32rpx;
				.receiptLeft{
					display: flex;
					align-items: center;
					image{
						width: 48rpx;
						height: 48rpx;
						margin-right:32rpx ;
					}
					text{
						font-weight: 500;
						font-size: 28rpx;
						color: #222222;
					}
				}
				.receiptRight{
					display: flex;
					align-items: center;
					image{
						width: 24rpx;
						height: 24rpx;
						margin-left: 10rpx;
					}
					.toolTip{
						font-family: PingFangSC, PingFang SC;
						width: 32rpx;
						height: 32rpx;
						border-radius:32rpx;
						text-align: center;
						line-height: 32rpx;
						background: #FD3D60;
						font-weight: 600;
						font-size: 16rpx;
						color: #FFFFFF;
					}
				}
			}
		}
	}
</style>
